<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div>
      <h1>可迭代接口</h1>
      <p>1.实现Iterable接口就是for...of的前提</p>
      <p>2.所有被for..of循环的数据结构都实现了Interable</p>
    </div>
    <script>
      const set = new Set(["foo", "bar", "baz"]);
      const iterator = set[Symbol.iterator]();
      console.log(iterator.next()); //{value: "foo", done: false}
      console.log(iterator.next()); //{value: "foo", done: false}
      console.log(iterator.next()); //{value: "baz", done: false}
      console.log(iterator.next()); //{value: undefined, done: true}
      console.log(iterator.next()); //{value: undefined, done: true}
    </script>
  </body>
</html>
